<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Ohne_Titel_1</title>

<script type="text/javascript" src="jquery-ui-1.8.18.custom/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.18.custom/js/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="timetable_style.css">

<script>
	$(function() {
  	       $( "#draggabletest" ).draggable({ 	             
	       stop: function(event, ui) { 
	                    
	       var pos = ui.position;
	       alert (pos.top+", "+pos.left);
	              
	       
          
       	       	          
 
           
	       }	             

           });	                       		
   
  });          
	</script>
	
			<script type="text/javascript">
		jsvar=10;
		document.myform.formvar.value = jsvar;
	</script>




</head>




<body>






<?php
session_start(); 
?> 

<?php 
if(!isset($_SESSION["username"])) 
   { 
   echo "Bitte erst <a href=\"login.html\">einloggen</a>"; 
   exit; 
   } 
?> 






<div style='background-color:blue; width:100px;  height:100px' id='draggabletest'>
<p>Nummer</p>
</div>









<form style="position:absolute; top:0px; left:0px;" name="myform" id="myform" action="timetable-update.php" method="post">
<?php
for ($i=0;$i<6;$i++)
{
echo"<input type='hidden' name='PositionTop".$i."' value=''>";
echo"<input type='hidden' name='PositionLeft".$i."' value=''>";
}
?>
<input type="submit" name="Speichern" value="Speichern">

</form>


<?php

for ($i=0;$i<6;$i++)
{
echo"<script>";
echo"	$(function() {";
echo"  	          $( '#draggable".$i."' ).draggable({ ";	             
echo"	             stop: function(event, ui) { ";
	              
echo"	          var pos".$i." = ui.position;";
echo"	          alert (pos".$i.".top+', '+pos".$i.".left);";

echo"             document.myform.PositionTop".$i.".value = pos".$i.".top;   ";
echo"             document.myform.PositionLeft".$i.".value = pos".$i.".left;   ";
       	       	          
	              	       	           	              
echo"	          }";	             

echo"            });";	                       		
echo"     });";          
echo"</script>";

echo"<div style='background-color:blue; width:100px;  height:100px' id='draggable".$i."'>";
echo"	<p>Nummer".$i."</p>";
echo"</div>";

}

?>





</body>

</html>
